﻿<script type="text/javascript">
    var AddRole = {};
    AddRole.Cancel = function () {
        $("#assignLocDiv").dialog('close');
    }
    AddRole.Confirm = function () {
        var para =com.serializeObj("form2");
        //var fatherid = $("#rootId").combobox('getValue');
        if ($("#form2").form("validate")) {
            com.ajax({
                type: "POST",
                url: "/Logic/BD/LocCompanyAjax.aspx?method=AddLoc",
                data: para,
                success: function (data) {
                    com.message(data.state, data.msg);
                    $("#assignLocDiv").dialog('close');
                    $("#tbList").datagrid("reload")
                }
            });
        }
    }
</script>
<script type="text/javascript">
    function checkName_exist() {
    com.ajax({
        type: "post",
        dataType: "text",
        url: "/Logic/BD/LocCompanyAjax.aspx?method=Check_LocName&&name=" + $("#LocNameId").val(),
        success: function (data) {
            console.log(data.state);
            if (data.state = "error")
            {
                alert("该地区名称已存在，请重新输入");
                return;
            }
            else
            {
              
            }

        }
    })
    }

</script>

<form id="form2" runat="server">
    <div style="height: 100%; overflow: auto">
        <input type="hidden" name="Id" />
        <div style="height: 20px; width: 300px"></div>
        <div style="height: 50px; width: 300px">
            请选父类：
                    <input id="rootId" name="LocUpperCode" class="easyui-combobox" data-options=" 
                        required:true,   
        valueField: 'value',    
        textField: 'text',    
        url: '/Logic/BD/LocCompanyAjax.aspx?method=GetLocRoot'" />
        </div>
        <div style="height: 50px; width: 300px">
            地区名称：
                    <input id="LocNameId" name="LocName" validtype="remote['/Logic/BD/LocCompanyAjax.aspx?method=Check_LocName','name']" data-options="
                        required:true" invalidmessage="该地区名已存在，请重新输入" class="easyui-validatebox" />
        </div>
        <div style="height: 120px; width: 500px">
            备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注：
                    <input id="Note" name="Note" style="height: 50px; width:240px" />
        </div>

    </div>
    <div class="dialog-bottom">
        <input type="hidden" id="hidAddRole.Action" />
        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ok'" onclick="AddRole.Confirm()">确定</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" onclick="AddRole.Cancel()">取消</a>
    </div>
</form>

